////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    CaesarsEmpireGuts.h                                          //
//  Developer:   Tommy Riddle                                                 //
//  Create date: 02/15/2005                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Caesar's Empire.              //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2005 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__CAESARSEMPIREGUTS_H__)
#define __CAESARSEMPIREGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "slotguts.h"
#include "getrand.h"

class CaesarsEmpireGuts : public SlotGuts
{
public:
	CaesarsEmpireGuts();

	virtual ~CaesarsEmpireGuts();

private:
	// Shared enums between client and server
	#include "CaesarsEmpireCommon.h"

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];

	static SpinResult m_aScatterWinSpinResults[6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nCount )
	{
		if ( nCount < 6 )
		{
			return m_aScatterWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	// Helper functions for classifyStops.
	SpinResult getCaesarLineWinResult( uint8* stops ) const;

	SpinResult getLineWinResultWithPossibleSubstitution(
		uint8* stops, uint8 testIcon, bool& bCaesarSubstitution ) const;

	bool doesCaesarLineWinPayMore( SpinResult srCaesar, SpinResult srOther,
		bool bCaesarSubstitution ) const;

	// Helper class for classifyScatters.
	class ClassifyScattersHelper
	{
	public:
		ClassifyScattersHelper( CaesarsEmpireGuts* pOwner, SlotSpin* spin );

		// classifyScatters helper function.
		void classifyScatters();

	private:
		CaesarsEmpireGuts* m_pOwner;
		SlotSpin* m_spin;
		uint8 m_gameMode;
		uint8 m_multiplier;
		int m_reel;
		int m_row;
		uint8 m_numColiseumIcons;
		int32 m_coliseumScatterPositions;
		int32 m_featureTriggerPositions;
		bool m_bColiseumOnLastReel;
		bool m_bFoundCaesar;
		uint8 m_position;

		// Helper functions.
		void tryForJackpot();
		void awardExtraCaesarSpins( int32 thisCaesarPosition );
		void evaluateScatterStop();
		void lookForScatterIcons();
		void evaluateScatterWin();
		void evaluateFeatureTrigger();
	};

	friend class ClassifyScattersHelper;

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

protected:

	// Override of the framework function.
	virtual void preSpinClassifyResults( SlotSpin *spin );
	virtual void Debug_SetLoserStops( uint8* pStops );

};


#endif // !defined(__CAESARSEMPIREGUTS_H__)
